package com.etc;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * @Auther: zhezhe
 * @Date: 2018/10/2511:10
 * @Description:
 */
public class DataSortMap extends Mapper<LongWritable, Text, IntWritable,IntWritable> {
    @Override
    protected void map(LongWritable key, Text value, Context context) throws
            IOException, InterruptedException {
        String line = value.toString();
        //trim方法，去除字符序列两端空格
        String line1= line.trim();
        if (line1!=""){
        context.write(new IntWritable(Integer.parseInt(line)),new IntWritable(1));}
    }
}
